console.log('-----3.抽象工厂模式-------')
//1.1 抽象工厂模式
export {}
//抽象产品工厂基类
abstract class AmriCoffe {
  constructor() {
    console.log(' 我是抽象产品工厂基类--AmriCoffe');
  }
};
abstract class LatteCoffe {
  constructor() {
    console.log(' 我是抽象产品工厂基类--Latte');
  }
};
abstract class FlowerCoffe {
  constructor() {
    console.log(' 我是抽象产品工厂基类--Flower');
  }
};
//具体产品工厂
class SatrtBuckAmriCoffeFcatory extends AmriCoffe{
  constructor() {
    super()
    console.log(' 我是具体产品工厂--SatrtBuckAmriCoffe');
  }
};
 class LuckinAmriCoffeFcatory extends AmriCoffe{
  constructor() {
    super()
    console.log(' 我是具体产品工厂--LuckinAmriCoffe');
  }
};
 class SatrtBuckLatteCoffeFcatory extends LatteCoffe{
  constructor() {
    super()
    console.log(' 我是具体产品工厂--SatrtBuckLatte');
  }
};
class LuckinLatteCoffeFcatory extends LatteCoffe{
  constructor() {
    super()
    console.log(' 我是具体产品工厂--LuckinLatte');
  }
};
class SatrtBuckFlowerCoffeFcatory extends FlowerCoffe{
  constructor() {
    super()
    console.log(' 具体产品工厂--SatrtBuckFlower');
  }
};
class LuckinFlowerCoffeFcatory extends FlowerCoffe{
  constructor() {
    super()
    console.log(' 具体产品工厂--LuckinFlower');
  }
};

//抽象族工厂基类
abstract class ShopFactory {
  abstract createAmriCoffe(): AmriCoffe;
  abstract createLatteCoffe(): LatteCoffe;
  abstract createFlowerCoffe(): FlowerCoffe;
  constructor() {
    console.log('我是抽象族工厂基类')
  }
}
//具体族工厂
class StartBuckFactory extends  ShopFactory{
  constructor() {
    super();

  };
  createAmriCoffe() {
    return new SatrtBuckAmriCoffeFcatory();
  };
  createLatteCoffe() {
    return new SatrtBuckLatteCoffeFcatory();
  };
  createFlowerCoffe() {
    return new SatrtBuckFlowerCoffeFcatory();
  }
};
class LuckinFactory extends  ShopFactory{
  constructor() {
    super();
  };
  createAmriCoffe() {
    return new LuckinAmriCoffeFcatory();
  };
  createLatteCoffe() {
    return new LuckinLatteCoffeFcatory();
  };
  createFlowerCoffe() {
    return new LuckinFlowerCoffeFcatory();
  }
};

//创建一个Luckin美式咖啡
let res1 = new LuckinFactory().createAmriCoffe();
console.log(res1);
//创建一个Luckin美式咖啡
let res2 = new StartBuckFactory().createLatteCoffe();
console.log(res2);

